package com.imy.lua.utils;

import android.app.Activity;

import com.imy.common.constant.Constant;
import com.imy.common.util.FileUtils;
import com.imy.common.util.UiUtil;
import com.imy.lua.helper.properties.PropertiesLoaderHelper;

import java.io.File;

public class ProjectUtils {

    public static boolean copyProjectToSD(Activity activity,String srcPath,String sdPath,String fileName){
        boolean b = FileUtils.copyAssetsToSD(activity, srcPath, sdPath);
        if (!b){
            return false;
        }
        boolean baseGlobalConfig = PropertiesLoaderHelper.createBaseGlobalConfig(Constant.PROJECT_PATH + "/" + fileName + "/global.properties"
        ,fileName);
        if (!baseGlobalConfig){
            return false;
        }
        //创建一个Res的文件夹
        File resFile = new File(Constant.PROJECT_PATH + "/" + fileName+"/res");
        if (!resFile.exists()){
            resFile.mkdir();
        }
        int deviceWidth = UiUtil.getDeviceWidth(activity);
        String screenPath = resFile.getAbsolutePath()+"/"+deviceWidth;
        File screenFile = new File(screenPath);
        if (!screenFile.exists()){
            screenFile.mkdir();
        }
        return true;
    }
}
